package com.thomasbrault.utils 
{
	import flash.net.FileReference;
	import flash.net.URLRequest;

	/**
	 * @author t.brault
	 */
	public class DirectDownload 
	{
		public static function download ( $url : String, $name : String = '') : void
		{
			var _name : String = $name != '' ? $name : $url.split('/')[$url.split('/').length-1];	
			var downloadURL : URLRequest = new URLRequest();
			downloadURL.url = $url;
			var file : FileReference = new FileReference();
			file.download(downloadURL, _name);
		}
	}
}
